﻿using System;
using System.Runtime.CompilerServices;

namespace Letter.IO.Binary;

public interface IBinaryOrderOperation
{
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    char ReadChar(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    short ReadInt16(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    ushort ReadUInt16(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    int ReadInt32(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    uint ReadUInt32(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    long ReadInt64(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    ulong ReadUInt64(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    float ReadFloat32(in ReadOnlySpan<byte> span);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    double ReadFloat64(in ReadOnlySpan<byte> span);

    
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteChar(in Span<byte> destination, char value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteInt16(in Span<byte> destination, short value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteUInt16(in Span<byte> destination, ushort value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteInt32(in Span<byte> destination, int value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteUInt32(in Span<byte> destination, uint value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteInt64(in Span<byte> destination, long value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteUInt64(in Span<byte> destination, ulong value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteFloat32(in Span<byte> destination, float value);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void WriteFloat64(in Span<byte> destination, double value);
}